﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UFIDA.U9.Cust.XH.PlugBE.Model
{
    public class SupdataModel
    {
        public dynamic operationinfo { get; set; }
        public OASupModel mainTable = new OASupModel();
    }

    public class OASupModel
    {
        public OASupModel() { }
        public OASupModel(UFIDA.U9.CBO.SCM.Supplier.Supplier s, bool isdel = false)
        {
            //this.id = s.ID.ToString();
            this.gysfl = (s.Category?.Name) ?? "";
            this.gysmc = s.Name;
            this.gysbm = s.Code;
            this.gysjc = s.ShortName;
            this.cjr = s.CreatedBy;
            this.cjsj = s.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss");
            this.cgy = s.Purchaser?.Code;
            this.lztj = s.APConfirmTerm?.Name;
            this.qymh = s.IsUseAppPortal ? "1" : "0";

            this.zt = isdel ? "1" : "0";
            this.sfsx = s.Effective.IsEffective ? "1" : "0";
            this.sxrq = s.Effective.EffectiveDate.ToString("yyyy-MM-dd HH:mm:ss");
            this.mrsl = (s.TaxSchedule?.Name) ?? "";
            this.lxr = (s.ContactObject?.Name) ?? "";
            this.jybz = (s.TradeCurrency?.Name) ?? "";
            this.sh = s.StateTaxNo;
            this.yxzhmc = "";
            this.yxzh = "";
            this.khx = "";
            foreach (CBO.SCM.Supplier.SupplierBankAccount item in s.SupplierBankAccount)
            {
                this.yxzhmc = item.Name;
                this.yxzh = item.Code;
                this.khx = item.Bank?.Name;
                break;
            }
        }
        /// <summary>
        /// id
        /// </summary>
        //public string id { get; set; }
        /// <summary>
        /// 供应商分类
        /// </summary>
        public string gysfl { get { return this._gysfl == null ? "" : this._gysfl; } set { this._gysfl = value; } }
        private string _gysfl;            /// <summary>
                                          /// 供应商名称
                                          /// </summary>
        public string gysmc { get; set; }
        /// <summary>
        /// 供应商编码
        /// </summary>
        public string gysbm { get; set; }
        /// <summary>
        /// 供应商简称
        /// </summary>
        public string gysjc { get; set; }
        /// <summary>
        /// 创建人传入：OA人员工号
        /// </summary>
        public string cjr { get; set; }
        /// <summary>
        /// 创建时间传入格式：yyyy-MM-dd HH:mm:ss
        /// </summary>
        public string cjsj { get; set; }
        /// <summary>
        /// 采购员传入：OA人员工号
        /// </summary>
        public string cgy { get { return this._cgy == null ? "" : this._cgy; } set { this._cgy = value; } }
        private string _cgy;
        /// <summary>
        /// 立账条件
        /// </summary>
        public string lztj { get; set; }
        /// <summary>
        /// 启用门户枚举：0 -不勾选；1 -勾选
        /// </summary>
        public string qymh { get; set; }
        /// <summary>
        /// 状态枚举：[0:启用,1:封存]
        /// </summary>
        public string zt { get; set; }
        /// <summary>
        /// 是否生效枚举：0 -不勾选；1 -勾选
        /// </summary>
        public string sfsx { get; set; }
        /// <summary>
        /// 生效日期传入格式：yyyy-MM-dd HH:mm:ss
        /// </summary>
        public string sxrq { get; set; }
        /// <summary>
        /// 默认税率
        /// </summary>
        public string mrsl { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string lxr { get; set; }
        /// <summary>
        /// 交易币种
        /// </summary>
        public string jybz { get; set; }
        /// <summary>
        /// 开户行
        /// </summary>
        public string khx { get { return this._khx == null ? "" : this._khx; } set { this._khx = value; } }
        private string _khx;
        /// <summary>
        /// 银行账户名称
        /// </summary>
        public string yxzhmc { get { return this._yxzhmc == null ? "" : this._yxzhmc; } set { this._yxzhmc = value; } }
        private string _yxzhmc;
        /// <summary>
        /// 银行账号
        /// </summary>
        public string yxzh { get { return this._yxzh == null ? "" : this._yxzh; } set { this._yxzh = value; } }
        private string _yxzh;
        /// <summary>
        /// 税号
        /// </summary>
        public string sh { get; set; }



    }
}
